home *** CD-ROM | disk | FTP | other *** search
- Attribute VB_Name = "MlStringModule"
- Option Explicit
-
- Public ml_CurrentLanguageId As Long
- Public Const ml_LanguageCount As Long = 2
- Public ResLoader As New ResourceReader
- Public InVbIde As Boolean
-
- Public Function ml_string(ByVal StringID As Long, Optional ByVal Text As String = "") As String
- 'NOTE: ResLoader fails when running in the VB debugger!
- If InVbIde Then
- ml_string = LoadResString(StringID)
- Else
- ml_string = ResLoader.ResString(StringID, ml_CurrentLanguageId)
- End If
- End Function
-
- Public Function ml_LanguageName(ByVal LangIndex As Long) As String
- Select Case LangIndex
- Case 2057: ml_LanguageName = "English (United Kingdom)"
- Case 1031: ml_LanguageName = "German (Standard)"
- Case Else: ml_LanguageName = "Invalid Language Index"
- End Select
- End Function
-
- Public Sub ml_ChangeLanguage(ByVal LanguageID As Long, ByVal Language As String)
-
- 'If an application uses UserControls or Class Modules compiled as separate
- 'projects, then these projects may (a) not support the same languages or
- '(b) not use the same ID number for a given language.
- 'If the language is changed at run time, an event can be fired via the
- 'MLSupport object, and received in all projects.
- 'This function checks whether the ID and Language name match before accepting
- 'the language change. If they do not match, then it searches for language
- 'using the language name not the ID. If the language is not found, then the
- 'language is not changed.
-
- 'Check whether the LanguageID and the Language match in this project.
- 'Use StrComp() for case insensitive comparison
- If StrComp(ml_LanguageName(LanguageID), Language, vbTextCompare) = 0 Then
- ml_CurrentLanguageId = LanguageID
- Else
- 'LanguageID may be different in this project.
- 'Search for the language string.
- For LanguageID = 0 To ml_LanguageCount - 1
- If StrComp(ml_LanguageName(LanguageID), Language, vbTextCompare) = 0 Then
- ml_CurrentLanguageId = LanguageID
- Exit For
- End If
- Next
- End If
-
- End Sub
-
-
-
- Public Function ml_LanguageIds() As Variant
- ml_LanguageIds = Array(2057, 1031)
- End Function
-
- Public Function SetInVbIde() As Boolean
- InVbIde = True
- SetInVbIde = True
- End Function
-